from downloadBoard import downloadBoard, downloadAndSave
from threadManager import ThreadManager
from utils import loadBoardNames

# updated existing boards
for board in loadBoardNames():
    #downloadAndSave(board)
    pass
downloadAndSave("/pol/")
# download board is none exist in database
if len(loadBoardNames()) == 0:
    downloadAndSave("/v/")

# detect number of replies to OPs on board

# load all boards 
'''
boardThreads = []
for i, name in enumerate(loadBoardNames()):
    print(f"Loading {name}")
    
    boardThreads.append(ThreadManager(name))
    boardThreads[i].load()

# seperate threads into lists based on OP
seperatedThreads = []
for board in boardThreads:
    seperatedThreads.append(board.createThreadsFromOPs())

# print all links 
for board in seperatedThreads:
    for thread in board:
        for link in thread.getLinks():
            print(link)
'''

'''
x = ThreadManager("/v/")
x.load()

for post in x:
    print(post.getText())
'''